#include "stdafx.h"
#include "./impactmgr.h"
#include "./impactobj.h"

ImpactObj::ImpactObj(int id, bool impactable)
: m_id(id)
, m_pAdditionFiltObj(NULL)
{
	if (impactable)
	{
		ImpactMgr::GetInstance().RegisterImpactObj(this);
	}
}

ImpactObj::~ImpactObj()
{
	ImpactMgr::GetInstance().UnRegisterImpactObj(this);
}

void ImpactObj::RegisterImpactObj()
{
	ImpactMgr::GetInstance().RegisterImpactObj(this);
}

void ImpactObj::UnRegisterImpactObj()
{
	ImpactMgr::GetInstance().UnRegisterImpactObj(this);
}

int ImpactObj::GetID()
{
	return m_id;
}

ImpactObj* ImpactObj::CalcImpact(Point& newPos)
{
	return ImpactMgr::GetInstance().CalcImpact(newPos, this, m_pAdditionFiltObj);
}

ImpactObj* ImpactObj::CalcIntersection()
{
	return ImpactMgr::GetInstance().CalcIntersection(this, m_pAdditionFiltObj);
}

void ImpactObj::SetAdditionFlitObj(ImpactObj* pAdditionFlitObj)
{
	m_pAdditionFiltObj = pAdditionFlitObj;
}

bool ImpactObj::Impacted()
{
	return true;
}